home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: April 28, 1997
- // Author: mpw
- //
- // Description:
- // The offsetCosPreset() procedure executes a offset cos operation on
- // a cos based on the offset option vars.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
- proc string pieceTogetherOffsetCosCmd(
- int $history,
- int $curvePartial,
- int $connectBreaks,
- int $stitch,
- int $cutLoop,
- float $distance,
- float $tolerance,
- int $subdivisionDensity)
- //
- // Description :
- // Piece together a offsetCos command.
- //
- {
- string $cmd;
- $cmd = "offsetCurveOnSurface ";
-
- // construction history
- $cmd = $cmd + " -ch ";
- if ( $history == 1 ) $cmd = $cmd + "on";
- else $cmd = $cmd + "off";
-
- // curve range.
- //
- $cmd = $cmd + " -rn " ;
- if( $curvePartial == 1 ) $cmd = $cmd + "true" ;
- else $cmd = $cmd + "false" ;
-
- // connect breaks
- $cmd = $cmd + " -cb " + $connectBreaks;
-
- // stitch
- if ( $stitch == 1 ) $cmd = $cmd + " -st true";
- else $cmd = $cmd + " -st false";
-
- // cut loops
- if ( $cutLoop == 1 ) $cmd = $cmd + " -cl true";
- else $cmd = $cmd + " -cl false";
-
- // offset distance
- $cmd = $cmd + " -d " + $distance;
-
- // offset tolerance
- $cmd = $cmd + " -tol " + $tolerance;
-
- // subdivision density
- $cmd = $cmd + " -sd " + $subdivisionDensity;
-
- return $cmd;
- }
-
- global proc offsetCosPreset(
- int $history,
- int $curvePartial,
- int $connectBreaks,
- int $stitch,
- int $cutLoop,
- float $distance,
- float $tolerance,
- int $subdivisionDensity)
- //
- // offsetCos with the preset options.
- // Use this proc when operation dragged to Shelf.
- //
- {
- // Get the list of nurbs cos selected. Works for curves on surface
- // Do this here because addViewNormal creates a node which will blow away the
- // selection list
- //
- global int $gSelectNurbsCurvesBit;
- global int $gSelectCurvesOnSurfacesBit;
- global int $gSelectSurfaceEdgeBit;
- global int $gSelectIsoparmsBit;
- string $curvesList[] = `filterExpand -ex true -sm $gSelectCurvesOnSurfacesBit -sm $gSelectSurfaceEdgeBit -sm $gSelectIsoparmsBit`;
-
- // build the command
- string $cmd = pieceTogetherOffsetCosCmd($history,
- $curvePartial,
- $connectBreaks,
- $stitch,
- $cutLoop,
- $distance,
- $tolerance,
- $subdivisionDensity);
-
- // placeholder for one selection item
- int $nitems = 1;
- $cmd = appendToCmdPlaceHoldersForSelectionItems( $cmd, $nitems );
-
- int $numCurves = size($curvesList) ;
- if( $numCurves < 1 ) {
- error "Select at least one curve on surface" ;
- } else {
-
- // compute each offset in turn
- string $offsetResults[];
- string $curve[1];
- for( $i = 0 ; $i < $numCurves ; $i++ ) {
- $curve[0] = $curvesList[$i];
- string $results[] = executeCmdOnItems( $cmd, $curve );
- $offsetResults = stringArrayCatenate($offsetResults, $results);
- }
-
- // select the results.
- //
-
- int $resultCount = size($offsetResults);
- if ( $resultCount > 0 )
- {
- string $selectString;
- $selectString = "select -r ";
- int $i;
- for ( $i = 0; $i < $resultCount; $i++ )
- {
- $selectString += $offsetResults[$i];
- $selectString += " ";
- }
- $selectString += ";";
- select -cl;
- eval($selectString);
-
- }
- }
- }
-